<?php
	/**
	 * 游戏登出
	 */
    class Loginout extends APIBase {
		
		public $tag = "Loginout";
		public $isLogin = true;
		
		
		public function before() {
			$this->initMysql();
			$this->initCacheRedis();
			$this->initDataRedis(0);
			$this->inithttp();
			return true;
		}
	
		public function logic() {
           $uid = $this->uid;
		   $this->data_redis->hset("hu:".$uid,'heartbeat_at',time());
		   $user_info = $this->data_redis->hGetAll("hu:".$uid);
var_dump($user_info);exit;
		   //登出数据上报
		   $param = array('data'=>array(array(
				'user_id'=>(int)$uid,'cid'=>'10004','platform_type'=>$user_info['platform_type'],'imei'=>$user_info['imei'],'ua'=>$user_info['device_num'],
				'logout_time'=>$now,'channel'=>$user_info['channel'],'agent'=>$user_info['agent'],'user_name'=>$user_info['name'],
				'user_level'=>1,'vip_level'=>1,'ip'=>$user_info['login_ip']))); 
		   
		   Data_report('login',$param);
	    }
	   


    	public function after() {
    		$this->deinitDataRedis();
			$this->deinitCacheRedis();
			$this->deinitMysql();
			$this->deinithttp();
		}
    }
?>
